<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="copyright" content="www.apicloud.com" />
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>舆情工作平台登陆</title>
<link rel="stylesheet" type="text/css" href="./css/api.css" />
<script type="text/javascript" src="./script/jquery.min.js"></script>
<style>
	html {height: 100%;}
	body {height: 100%;width:100%;background-image:url(./res/bg.png);background-size: 100%;}
	
	input {height: 50px;font-size: 18px;color: #8E8C8C;width: 80%;}
	input::-webkit-input-placeholder {color: #ccc;} 
	.top_logo{ width:90%; margin:0 5%;}
	.main_logo{ width:60%; margin:0 20%;}
	 
	.email,.passwd {/*margin-top: 3px;*/background: #fff;}
	.passwd img, .email img {vertical-align: top;}
	.item { width:90%; margin:0 5%;position: relative;}
	.email{-webkit-border-radius: 5px 5px 0px 0px;  border: 1px solid #acacac;}
	.passwd{-webkit-border-radius: 0px 0px 5px 5px; border-right: 1px solid #acacac;border-left: 1px solid #acacac; border-bottom: 1px solid #acacac;}
	/*.email, .passwd, .btn {margin:3px 10px;}*/
	.btn {margin:3px 10px;}
	.btn {background: red;color: #fff;height: 40px; text-align: center; line-height: 40px; font-size: 20px;margin-top: 20px;border-radius: 5px;}
 	.email img {width: 25px; margin-top: 15px; margin-left: 10px; margin-right: 9px;}
	.passwd img {height: 25px;margin-top: 10px; margin-left: 10px;margin-right: 10px;}
	 
	/* 底部样式 */
	.bottom {/*position: absolute;bottom: 0;*/width: 100%; text-align: center;/*padding-bottom: 20px;*/font-size: 12px;}     
    .bottom>span {line-height: 26px;color: #999999; font-size: 1.2em;}
    .bottom>span>a{line-height: 26px;color: blue; font-size: 1.2em;}
	.bottom>span>a:hover{color: #999999;}
 
	input {outline: none;}
</style>
</head>
<body>
	<div class="top">
		<div id="clear_2"></div>		 
		<div class="top_logo"><img src="./image/admin/top_logo.png" width="100%"/></div>	 
		<div id="clear_3"></div>
		<div class="main_logo"><img src="./image/admin/main_logo.png" width="100%"/></div>
		<div id="clear_4"></div>
		<!---------------------------登陆信息输入框------------------------------------->
		<div class="item email">
			<img src="./image/admin/user.png" alt="">
			<input id="username" name="username" type="text" placeholder="输入手机号" >
		</div>
		<div class="item passwd">
			<img src="./image/admin/password.png" alt="">
			<input id="password" name="password" type="password" placeholder="输入密码" >
		</div>
		<!---------------------------登陆信息输入框------------------------------------->
		<div id="clear_5"></div>
		<div class="btn" tapmode="buyhover" onclick="checkform()">登 录</div>
	</div> 
	<!---------------------------底部信息间距------------------------------------->
	<div id="clear"> </div>
	<!---------------------------底部信息间距------------------------------------->
	<!---------------------------底部信息------------------------------------->
 	<div class="bottom">	 
			<span id="tel">联系电话：<a href="tel:0531-85196544">0531-85196544</a></span>
			<span>Copyright© 2015 大众报业集团·大众网·舆情中心</span>		 		 
	</div>
	<!---------------------------底部信息------------------------------------->
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript" src="./script/api.data.js"></script>
<script type="text/javascript" src="./script/jquery.md5.js"></script>
<script type="text/javascript">
   apiready = function() { 
        //获取联系电话
        cntact_phone();
        
        //获取个div层之间的间距
        document.getElementById('clear_2').style.height = api.winHeight*0.07+"px";
        document.getElementById('clear_3').style.height = api.winHeight*0.05+"px";
        document.getElementById('clear_4').style.height = api.winHeight*0.06+"px";
        document.getElementById('clear_5').style.height = api.winHeight*0.04+"px";
   
        //获取底部信息间距 页面高度减去底部和顶部的高度再减去距底部的20得出间距高度
         var top_height = $api.dom('.top').offsetHeight;
         var bottom_height = $api.dom('.bottom').offsetHeight;
         var clear_height = api.winHeight-top_height-bottom_height-20;       
         document.getElementById('clear').style.height = clear_height+'px';
                 
         //从保存文件中获取相关信息         
         api.readFile({
             path:'fs://yqgzpt.txt'
         }, function(ret, err){           
             var data = eval('('+ret.data+')');
 
             var username = data.username; 
             var password = data.password;
             var access_token = data.access_token;
             if(username){document.getElementById("username").value = username;}
             if(password){document.getElementById("password").value = password;}       
             if(access_token){
                  setTimeout(function(){checkform();},100)
              }
         });                 
     }
  
    
	//点击登录
	function checkform() {
	      var systemType = api.systemType; 
	      if("ios" == api.systemType){                
		      var systemType = "iphone";                          
          }
          var deviceId = faultylabs.MD5(api.deviceId);
          deviceId=deviceId.toLowerCase();//将字符串大写转成小写
	      //获取input中的登陆信息
		  var username = document.getElementById("username").value;
		  var password = document.getElementById("password").value;		 
 		  login(username,password,deviceId,systemType);
	}

</script>
</html>